sepolicy: Add better private API for setfscreatecon
authorColin Walters <walters@verbum.org>
Tue, 21 Mar 2017 00:51:22 +0000 (20:51 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Wed, 22 Mar 2017 16:24:06 +0000 (16:24 +0000)
commit7b2370dc869ce5ba76769853ef7fd0b081b15010
tree0cfa81ee2fdce314e3edcd5e5facf5247297e21a
parentd7f4a326b98cb1bfe3fb939348620013e1ec5a9b
sepolicy: Add better private API for setfscreatecon

Use `g_auto()` more sanely with a struct implmenting the "is initialized"
pattern.  This is way less ugly for callers, and fixes bugs like
us calling `setfscreatecon()` even if an error occurred beforehand.

Also fold in the logic for "NULL or not loaded" sepolicy into the setup rather
than requiring callers to inline it.

Prep for more users of this function.

Closes: #746
Approved by: jlebon
src/libostree/ostree-sepolicy-private.h [new file with mode: 0644]
src/libostree/ostree-sepolicy.c
src/libostree/ostree-sysroot-deploy.c